/** ROI管理路由 */
import Layout from '@/views/layout/RoiLayout'

const layout = function (meta = {}, path = '/roi', requiresAuth = true) {
    return {
        path: path,
        component: Layout,
        meta: {
            requiresAuth: requiresAuth,
            ...meta
        }
    }
}

export default [
    {
        ...layout({
            permissions: ['roiManage', 'groupROI'],
            title: '公司ROI',
            icon: 'group'
        }, '/roi/groupROI'),
        alwaysShow: true,
        children: [
            // 集团总统计
            {
                path: 'groupAllStatis',
                component: () => import('@/views/admin/roi/groupAllStatis'),
                meta: {
                    title: '公司总统计',
                    requiresAuth: true,
                    permissions: ['roiManage', 'groupROI', 'groupAllStatis']
                }
            },
            // ROI消耗
            {
                name: 'consume',
                path: 'consume',
                component: () => import('@/views/admin/roi/consume'),
                meta: {
                    title: 'ROI消耗',
                    requiresAuth: true,
                    permissions: ['roiManage', 'groupROI', 'groupROIConsume']
                }
            },
            // ROI明细
            {
                path: 'channel',
                component: () => import('@/views/admin/roi/channel'),
                meta: {
                    title: 'ROI明细',//渠道ROI
                    requiresAuth: true,
                    permissions: ['roiManage', 'groupROI', 'groupROIDetail']
                }
            },
            // ROI统计
            {
                path: 'statis',
                component: () => import('@/views/admin/roi/statis'),
                meta: {
                    title: 'ROI统计',
                    requiresAuth: true,
                    permissions: ['roiManage', 'groupROI', 'groupROIStatis']
                }
            },
            // 预收益统计
            // {
            //     path: 'preRevenueStatis',
            //     component: () => import('@/views/admin/roi/preRevenueStatis'),
            //     meta: {
            //         title: '预收益统计',
            //         requiresAuth: true,
            //         permissions: ['roiManage', 'groupROI', 'groupPreRevenue']
            //     }
            // },
        ]
    },
    {
        ...layout({
            permissions: ['roiManage', 'deptROI'],
            title: '部门ROI',
            icon: 'dept'
        }, '/roi/depROI'),
        alwaysShow: true,
        children: [
            // ROI消耗
            {
                name: 'consumeDept',
                path: 'consumeDept',
                component: () => import('@/views/admin/roi/consumeDept'),
                meta: {
                    title: 'ROI消耗',
                    requiresAuth: true,
                    permissions: ['roiManage', 'deptROI', 'deptROIConsume']
                }
            },
            // ROI明细
            {
                path: 'channelDept',
                component: () => import('@/views/admin/roi/channelDept'),
                meta: {
                    title: 'ROI明细',
                    requiresAuth: true,
                    permissions: ['roiManage', 'deptROI', 'deptROIDetail']
                }
            },
            // ROI统计
            {
                path: 'statisDept',
                component: () => import('@/views/admin/roi/statisDept'),
                meta: {
                    title: 'ROI统计',
                    requiresAuth: true,
                    permissions: ['roiManage', 'deptROI', 'deptROIStatis']
                }
            },
            // 预收益统计
            // {
            //     path: 'preRevenueStatisDept',
            //     component: () => import('@/views/admin/roi/preRevenueStatisDept'),
            //     meta: {
            //         title: '预收益统计',
            //         requiresAuth: true,
            //         permissions: ['roiManage', 'deptROI', 'deptPreRevenue']
            //     }
            // }
        ]
    },
]
